package wnhz.com.business.homemain;

import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import wnhz.com.business.R;
import wnhz.com.business.base.BaseRVAdapter;
import wnhz.com.business.base.BaseViewHolder;
import wnhz.com.business.base.MyBaseActivity;
import wnhz.com.business.base.MyBaseFragment;
import wnhz.com.business.impl.ActionBarClickListener;
import wnhz.com.business.view.TranslucentActionBar;

/**
 * Created by dongfeng on 2018/1/17 0017.
 */

public class MainContactFragment extends MyBaseFragment implements ActionBarClickListener {

    @BindView(R.id.actionbar)
    TranslucentActionBar actionbar;
    @BindView(R.id.recycler_my_friends)
    RecyclerView recycler_my_friends;


    private MyBaseActivity activity;
    private List<String> itemddd = new ArrayList<>();
    private BaseRVAdapter adapter1;


    @Override
    protected void handleMsg(Message msg) {

    }

    @Override
    protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_main_contact, container, false);

        ButterKnife.bind(this, view);
        activity = (MyBaseActivity) getActivity();
        actionbar.setData("通讯录", 0, null, R.drawable.tab_menu_me_normal2x,null , 0, this);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            actionbar.setStatusBarHeight(getStatusBarHeight());
        }
        itemddd.clear();
        for (int i = 0; i < 6; i++) {

            itemddd.add("a" + i);
        }

        initFriendsList();
        return view;
    }

    private void initFriendsList() {

        recycler_my_friends.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));

        adapter1 = new BaseRVAdapter(getContext(),itemddd){
            @Override
            public int getLayoutId(int viewType) {
                return R.layout.item_main_home_public_msg;
            }

            @Override
            public void onBind(BaseViewHolder holder, int position) {

            }
        };
        recycler_my_friends.setAdapter(adapter1);

    }

    @Override
    public void onLeftClick() {

    }

    @Override
    public void onRightClick() {

    }

    @Override
    public void onEditTextClick() {

    }
}
